package main

import (
	"fmt"
	"log"
	"net/http"
	"src/login"
)

func main() {
	fmt.Println("server start")
	http.HandleFunc("/login", loginByPassword)
	// 获取验证码
	http.HandleFunc("/getPhoneCode", getPhoneCode)
	// 校验验证码
	http.HandleFunc("/checkCode", checkCode)
	if err := http.ListenAndServe(":8888", nil); err != nil{
		log.Fatal("Server error", err)
	}
	fmt.Println("server out")
}

func loginByPassword(w http.ResponseWriter, r *http.Request)  {
	login.Login(w, r)
}

func getPhoneCode(w http.ResponseWriter, r *http.Request)  {
	login.GetPhoneCode(w, r)
}

func checkCode(w http.ResponseWriter, r *http.Request)  {
	login.CheckCode(w, r)
}





